sudo apt-get update
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  
 
 sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

sudo docker run hello-world


uname -s && uname -m

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

docker-compose --version 


# 配置docker国内镜像源
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://docker.m.daocloud.io","https://va04koog.mirror.aliyuncs.com","https://ccr.ccs.tencentyun.com","https://docker.mirrors.ustc.edu.cn","https://3e7a6110710a48b596c16144ccc6f741.mirror.swr.myhuaweicloud.com"]
}
EOF
# 好像就"https://docker.m.daocloud.io"这个可用，其他失效
sudo systemctl daemon-reload
sudo systemctl restart docker
cat /etc/docker/daemon.json 
 
 
# 轮询模拟器的状态，直到检测到模拟器已经启动完成

while true; do
    output=$(docker exec -it <容器ID或名称> adb shell getprop sys.boot_completed)
    if [[ $output == "1" ]]; then
        echo "Simulation has started successfully."
        break
    else
        echo "Waiting for the simulation to complete..."
        sleep 5
    fi
done